package base.arrays;

import java.util.Arrays;

public class 泛型 {
    public static void main(String[] args) {
        MyArrays<String> arr = new MyArrays<>();
        arr.add("陈汉升");arr.add("萧容鱼");arr.add("沈幼楚");
        System.out.println(arr.toString());
    }
}

class MyArrays<E>{
    Object[] obj = new Object[10];
    int size;

    public boolean add(E e){
        obj[size] = e;
        size++;
        return true;
    }

    public E get(int index){
        return (E)obj[index];
    }

    @Override
    public String toString() {
        return Arrays.toString(obj);
    }
}